#!/usr/bin/env python

# -------------------------------
# projects/python/collatz/main.py
# Copyright (C) 2009
# Glenn P. Downing
# -------------------------------

# To run the program
#     main.py < Collatz.in > Collatz.out

# To document the program
#     pydoc -w main

# -------
# globals
# -------

i = 0 # input: don't change after reading
j = 0 # input: don't change after reading
v = 0 # output
cache = {} #cache

# -----------
# InputReader
# -----------

class InputReader (object) :
    def read (self) :
        return raw_input()

# ------------
# OutputWriter
# ------------

class OutputWriter (object) :
    def write (self, *a) :
        for w in a :
            print w,
        print

# -------
# my_read
# -------

def my_read (r) :
    """
    reads an int into i and j
    return true if that succeeds, false otherwise
    """
    global i
    global j
    try :
        s = r.read()
    except EOFError :
        return False
    l = s.split()
    i = int(l[0])
    j = int(l[1])
    return True

# -------
# my_eval
# -------

def my_eval () :
    """
    computes the max cycle length in the range [i, j]
    and stores the result in v
    """
    global v
    global i
    global j
    global cache

    v = 0

    # Make sure that it doesn't matter if a smaller or larger number is entered first
    if i < j:
        a = i
        b = j
    else:
        a = j
        b = i

    assert a <= b

    #find cycle length for each number in range and if needed update the cache
    for x in range(a, b+1):
        if not cache.has_key(x):
            cache[x] = cycle_length(x)

        counter = cache[x]

        assert counter != 0

        #check to see if the current calculated cycle length is greater than the current max cycle length
        if counter > v:
            v = counter

# -------
# cycle_length
# -------

def cycle_length(n):
    """
    computes the cycle length
    of a given number and updates the cache
    """
    if (n == 1):
        return 1
    elif cache.has_key(n):
        return cache[n]
    elif (n % 2) == 0:
        cache[n / 2] = cycle_length(n/2)
        return 1 + cache[n/2]
    else:
        assert (n%2) != 0
        cache[n + (n >> 1) + 1] = cycle_length(n + (n >> 1) + 1)
        return 2 + cache[n + (n >> 1) + 1]




# --------
# my_print
# --------

def my_print (w) :
    """
    writes the values of i, j, and v
    """
    w.write(i, j, v)

# ----
# main
# ----

def main () :
    """
    runs the program
    """


    while my_read(InputReader()) :
        my_eval()
        my_print(OutputWriter())

if __name__ == "__main__" :
    main()